<template lang="pug">
transition(:duration="500", enter-active-class="animated bounceInRight", leave-active-class="animated bounceOutRight")
  a.origin-sitee(:href="viewUrl + $route.params.panoId", v-if="getIsInIframe" target="_blank") 源地址

</template>

<script>
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      viewUrl: window.$globalconfig.URLS.PANO_VIEW_PREFIX,
    }
  },
  computed: {
    ...mapGetters(['panoInfo']),
    getIsInIframe() {
      if (this.panoInfo) {
        if (window.self != window.top) {
          let url
          try {
            url = window.document.referrer
          } catch (error) {
            url = window.parent.location.href
          }
          let whiteDomain = this.panoInfo.whitedomain.split(',')
          whiteDomain.push(window.$globalconfig.DOMAIN)
          if (whiteDomain.length > 0) {
            let falg = true
            whiteDomain.map(item => {
              if (url.indexOf(item) != -1 && item) {
                falg = false
              }
            })
            return falg
          }else {
            return true
          }
        }
      }
    },
  },
}
</script>

<style lang="stylus">
@import '~@/assets/styles/mixin.styl'
.origin-sitee
  position fixed
  z-index 2
  right 2px
  top 60%
  padding 2px
  width 20px
  text-align center
  line-height 16px
  border-radius 5px 0 0 5px
  background-color rgba(0, 0, 0, 0.2)
  font-size 12px
  text-shadow 0 0 10px #000
  color #fff

</style>
